{% extends 'home_page/base_index.html' %}
{% load static %}


{% block show_body %}
    {# 个人信息 #}
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">个人信息</h4>
                </div>
                <div class="card-content">
                    <div class="card-body">
                        <form class="form">
                            <div class="row">
                                <div class="col-md-6 col-12">
                                    <div class="form-group"><label for="first-name-column">姓名</label><input
                                            type="text" id="first-name-column" class="form-control"
                                            placeholder="{{ student.stu_name }}"
                                            disabled="disabled"></div>
                                </div>
                                <div class="col-md-6 col-12">
                                    <div class="form-group"><label for="last-name-column">学号</label><input
                                            type="text" id="last-name-column" class="form-control"
                                            placeholder="{{ student.stu_num }}"
                                            disabled="disabled"></div>
                                </div>
                                <div class="col-md-6 col-12">
                                    <div class="form-group"><label for="city-column">性别</label><input type="text"
                                                                                                        id="city-column"
                                                                                                        class="form-control"
                                                                                                        placeholder="{{ student.gender }}"
                                                                                                        disabled="disabled">
                                    </div>
                                </div>
                                <div class="col-md-6 col-12">
                                    <div class="form-group"><label for="country-floating">学院</label><input type="text"
                                                                                                             id="country-floating"
                                                                                                             class="form-control"
                                                                                                             disabled="disabled"
                                                                                                             placeholder="{{ student.department }}">
                                    </div>
                                </div>
                                <div class="col-md-6 col-12">
                                    <div class="form-group"><label for="company-column">邮箱</label>
                                        <input type="text" id="company-column" class="form-control" disabled="disabled"
                                               placeholder="{{ student.email }}">
                                    </div>
                                </div>
                                <div class="col-md-6 col-12">
                                    <div class="form-group"><label for="company-column">电话号码</label>
                                        <input type="text" id="company-column" class="form-control" disabled="disabled"
                                               placeholder="{{ student.phone_number }}">
                                    </div>
                                </div>
                                <div class="col-12 d-flex justify-content-end">
                                    创建时间：{{ student.create_time }}
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-12">
            <div class="card">
                <div class="card-header"><h4>通告信息</h4></div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-hover table-lg">
                            <thead>
                            <tr>
                                <th>发布人</th>
                                <th>标题</th>
                                <th>发布时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for notice in notices %}
                            	<tr>
                                    <td class="col-3">
                                        <div class="d-flex align-items-center">
                                            <p class="font-bold ms-3 mb-0">{{ notice.publisher.name }}</p>
                                        </div>
                                    </td>
                                    <td class="col-auto"><p class=" mb-0">{{ notice.title }}</p></td>
                                    <td class="col-auto"><p class=" mb-0">{{ notice.pub_date }}</p></td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

{% endblock %}

{% block show_user %}
    {# 当学生用户登录的时候显示学生的姓名和学号 #}
    <div class="card">
        <div class="card-body py-4 px-5">
            <div class="d-flex align-items-center">
                {# 性别不同默认头像不一样 #}
                <div class="avatar avatar-xl">
                    {% if gender == 'female' %}
                        <img src="{% static 'picture/5.jpg' %}" alt="Face female">
                    {% else %}
                        <img src="{% static 'picture/2.jpg' %}" alt="Face male">
                    {% endif %}
                </div>
                {# 加载学生的姓名和学号 #}
                <div class="ms-3 name"><h5 class="font-bold">姓名：{{ student.stu_name }}</h5>
                    <h6 class="text-muted mb-0">
                        学号：{{ request.session.user_id }}
                    </h6>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
